define(['./../../initial', './../../model/Project', 'lightbox'],
    function () {
        var app = angular.module('App.home');
        app.controller('reportCtrl', ['$scope', '$timeout', '$rootScope', '$state', '$stateParams', 'Project', 'allProjects',
            function ($scope, $timeout, $rootScope, $state, $stateParams, Project, allProjects) {

                //工程类型
                $scope.types = Project.filterPrjTypes;

                $scope.cityList = allProjects;

                $scope.projectType = $scope.types.filter(function (item) {
                    return item.projectCode === $stateParams.projectTypeCode;
                })[0].projectType;

                //初始化dropdown
                $timeout(function () {
                    $('.dropdown').dropdown();
                }, 300);

                //导航到不同的项目类型中去
                $scope.goProjectType = function (typeCode) {
                    $state.go('report', {
                        projectTypeCode: typeCode
                    });
                };
            }
        ]);
    });
